import Vue from 'vue'
import VueRouter from 'vue-router'
import layout from '@/views/layout/layout'

Vue.use(VueRouter)

const routes = [
    {
        path: '/',
        redirect: '/home',
    },
    {
        path: '/',
        name: 'layout',
        component: layout,
        children : [
            {
                path: '/home',
                name: 'home',
                meta : {
                    title : '首页'
                },
                component: () => import('@/views/home/home'),
            },
            {
                path: '/indexDetail',
                name: 'indexDetail',
                meta : {
                    title : '精选详情'
                },
                component: () => import('@/views/index/indexDetail'),
            },
            {
                path: '/index',
                name: 'index',
                meta : {
                    title : '精选'
                },
                component: () => import('@/views/index/index'),
            },
            {
                path: '/banner',
                name: 'banner',
                meta : {
                    title : 'banner'
                },
                component: () => import('@/views/banner/banner'),
            },
            {
                path: '/version',
                name: 'version',
                meta : {
                    title : '版本'
                },
                component: () => import('@/views/version/version'),
            },
            {
                path: '/addVersion',
                name: 'addVersion',
                meta : {
                    title : '新增/修改版本'
                },
                component: () => import('@/views/version/addVersion'),
            },
            {
                path: '/admin',
                name: 'admin',
                meta : {
                    title : '管理员'
                },
                component: () => import('@/views/admin/admin'),
            },
            {
                path: '/user',
                name: 'user',
                meta : {
                    title : '用户管理'
                },
                component: () => import('@/views/user/user'),
            },
            {
                path: '/userDetail',
                name: 'userDetail',
                meta : {
                    title : '用户详情'
                },
                component: () => import('@/views/userDetail/userDetail'),
            },
            {
                path: '/song',
                name: 'song',
                meta : {
                    title : '歌曲管理'
                },
                component: () => import('@/views/song/song'),
            },
            {
                path: '/book',
                name: 'home',
                meta : {
                    title : '小说管理'
                },
                component: () => import('@/views/book/book'),
            },
        ]
    },
    {
        path: '/login',
        name: 'login',
        meta : {
            title : '登录'
        },
        component: () => import('@/views/login/login.vue'),
    },
]

const router = new VueRouter({
    routes
})

export default router
